library(coda)
## Warning: package 'coda' was built under R version 3.5.2
library(lattice)

2R hum

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/1.hum.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed          1      0.562  
## Fst2  passed          1      0.858  
## Fst3  passed          1      0.374  
## Fst4  passed          1      0.178  
## Fst5  passed          1      0.885  
## Fst6  passed          1      0.915  
## Fst7  passed          1      0.363  
## Fst8  passed       1001      0.118  
## Fst9  passed          1      0.360  
## Fst10 passed          1      0.988  
## Fst11 passed          1      0.689  
## Fst12 passed          1      0.461  
## Fst13 passed          1      0.930  
## Fst14 passed          1      0.470  
##                                 
##       Halfwidth Mean   Halfwidth
##       test                      
## Fst1  passed    0.0197 1.88e-06 
## Fst2  passed    0.0823 5.12e-06 
## Fst3  passed    0.0464 3.32e-06 
## Fst4  passed    0.0403 2.82e-06 
## Fst5  passed    0.1553 7.99e-06 
## Fst6  passed    0.4601 1.58e-05 
## Fst7  passed    0.3979 1.58e-05 
## Fst8  passed    0.0153 1.80e-06 
## Fst9  passed    0.0133 1.58e-06 
## Fst10 passed    0.0121 1.58e-06 
## Fst11 passed    0.5015 1.52e-05 
## Fst12 passed    0.1194 6.77e-06 
## Fst13 passed    0.0130 2.20e-06 
## Fst14 passed    0.0191 2.46e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2536.325 2278.556 2592.993 2425.225 2499.479 3098.282 3334.913 2028.386 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 1904.999 1798.632 2851.276 2643.240 4013.362 4437.809
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                Fst1          Fst2         Fst3         Fst4         Fst5
## Lag 0    1.00000000  1.0000000000  1.000000000  1.000000000  1.000000000
## Lag 10   0.27785281  0.3301838318  0.316823815  0.346584534  0.303192931
## Lag 50   0.02176418  0.0285955203  0.029779557  0.024448861 -0.001244466
## Lag 100 -0.02381834 -0.0080026490 -0.019820165  0.011712968 -0.009972557
## Lag 500 -0.01217865 -0.0006909855  0.001081149 -0.002638427 -0.003595192
##                Fst6         Fst7         Fst8        Fst9       Fst10
## Lag 0   1.000000000  1.000000000  1.000000000  1.00000000  1.00000000
## Lag 10  0.205152419  0.201427261  0.387551779  0.39613767  0.40573444
## Lag 50  0.017621393  0.008660413  0.050865608  0.04121815  0.06165115
## Lag 100 0.002190546  0.004839251 -0.033427962  0.02466069 -0.01870449
## Lag 500 0.024612240 -0.001941502 -0.002418183 -0.02733780 -0.01457587
##                Fst11      Fst12       Fst13        Fst14
## Lag 0    1.000000000 1.00000000  1.00000000  1.000000000
## Lag 10   0.273493229 0.30816461  0.08363183  0.059368585
## Lag 50   0.028631380 0.02434193  0.01974170 -0.015651225
## Lag 100 -0.008380324 0.01026715  0.03093587 -0.004660783
## Lag 500  0.032197514 0.02002391 -0.02071807 -0.001949634
levelplot(t(autocorr.diag(chain)))

plot(chain)

2L hum

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/2.hum.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed         1       0.3992 
## Fst2  passed       501       0.1754 
## Fst3  passed         1       0.5333 
## Fst4  passed         1       0.3280 
## Fst5  passed         1       0.3243 
## Fst6  passed         1       0.8281 
## Fst7  passed         1       0.1552 
## Fst8  passed         1       0.1717 
## Fst9  passed         1       0.8562 
## Fst10 passed         1       0.0757 
## Fst11 passed         1       0.7749 
## Fst12 passed         1       0.1924 
## Fst13 passed         1       0.7310 
## Fst14 passed         1       0.1980 
##                                 
##       Halfwidth Mean   Halfwidth
##       test                      
## Fst1  passed    0.0752 6.78e-06 
## Fst2  passed    0.1036 9.18e-06 
## Fst3  passed    0.0784 6.65e-06 
## Fst4  passed    0.0533 4.89e-06 
## Fst5  passed    0.1085 7.02e-06 
## Fst6  passed    0.4365 1.82e-05 
## Fst7  passed    0.3588 1.80e-05 
## Fst8  passed    0.0685 5.68e-06 
## Fst9  passed    0.0106 1.80e-06 
## Fst10 passed    0.0205 2.43e-06 
## Fst11 passed    0.4144 1.73e-05 
## Fst12 passed    0.1499 1.08e-05 
## Fst13 passed    0.0115 2.48e-06 
## Fst14 passed    0.0237 3.45e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2147.361 1896.082 2305.720 2008.452 2897.208 3369.080 3643.259 2217.398 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 1735.289 2213.279 2899.372 2369.985 4002.273 3874.588
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                 Fst1          Fst2          Fst3         Fst4         Fst5
## Lag 0    1.000000000  1.0000000000  1.0000000000  1.000000000  1.000000000
## Lag 10   0.352366462  0.3568173671  0.3428252953  0.335424759  0.244970167
## Lag 50   0.018895418  0.0464418197 -0.0005947549  0.052251907 -0.008939186
## Lag 100  0.002776815 -0.0001161271 -0.0046041590  0.004723725 -0.012256176
## Lag 500 -0.014623652 -0.0208739717 -0.0099515620 -0.007372431  0.027290692
##                Fst6         Fst7        Fst8        Fst9       Fst10
## Lag 0    1.00000000  1.000000000  1.00000000 1.000000000  1.00000000
## Lag 10   0.19468204  0.156775865  0.35650106 0.372102467  0.35465145
## Lag 50  -0.01041779 -0.029685642  0.00744280 0.052183604  0.02516319
## Lag 100  0.00505018 -0.010919707 -0.01503548 0.007183738 -0.01705470
## Lag 500  0.01151850 -0.006042276 -0.01308004 0.028377252 -0.02215027
##                Fst11        Fst12       Fst13        Fst14
## Lag 0    1.000000000  1.000000000  1.00000000  1.000000000
## Lag 10   0.265737445  0.316133769  0.08966331  0.126616078
## Lag 50   0.006336527  0.026254019  0.01206323  0.007875863
## Lag 100 -0.013620652 -0.008680995  0.01501339 -0.032948676
## Lag 500  0.022272096 -0.005380903 -0.01207679  0.001023047
levelplot(t(autocorr.diag(chain)))

plot(chain)

3R hum

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/3.hum.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed       1         0.4584 
## Fst2  passed       1         0.8426 
## Fst3  passed       1         0.0680 
## Fst4  passed       1         0.5784 
## Fst5  passed       1         0.1014 
## Fst6  passed       1         0.5427 
## Fst7  passed       1         0.6595 
## Fst8  passed       1         0.4914 
## Fst9  passed       1         0.0576 
## Fst10 passed       1         0.1126 
## Fst11 passed       1         0.6060 
## Fst12 passed       1         0.9416 
## Fst13 passed       1         0.4354 
## Fst14 passed       1         0.8632 
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00351 8.86e-07 
## Fst2  passed    0.03514 3.10e-06 
## Fst3  passed    0.01651 1.97e-06 
## Fst4  passed    0.02279 1.84e-06 
## Fst5  passed    0.06877 4.93e-06 
## Fst6  passed    0.49868 1.66e-05 
## Fst7  passed    0.43627 1.76e-05 
## Fst8  passed    0.00685 8.96e-07 
## Fst9  passed    0.00377 7.61e-07 
## Fst10 passed    0.00422 8.06e-07 
## Fst11 passed    0.30289 1.45e-05 
## Fst12 passed    0.08663 5.20e-06 
## Fst13 passed    0.00565 1.80e-06 
## Fst14 passed    0.00613 1.98e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2657.132 2364.465 2319.247 2677.497 2712.399 3674.859 3947.833 2703.998 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 2413.677 2635.033 2649.889 3091.481 4406.603 4028.102
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                 Fst1         Fst2        Fst3          Fst4         Fst5
## Lag 0    1.000000000  1.000000000  1.00000000  1.0000000000  1.000000000
## Lag 10   0.195644022  0.278496457  0.25268574  0.2725073193  0.260215471
## Lag 50   0.034395499  0.037574290  0.04515135  0.0009340822  0.005644524
## Lag 100  0.002619375  0.004852783 -0.01607054 -0.0146651469 -0.009117449
## Lag 500 -0.025735178 -0.014407072 -0.02209774  0.0022165117  0.014865761
##                Fst6         Fst7         Fst8         Fst9        Fst10
## Lag 0    1.00000000  1.000000000  1.000000000  1.000000000  1.000000000
## Lag 10   0.18109791  0.143995747  0.258364362  0.276924565  0.253671949
## Lag 50  -0.02215939  0.022461553  0.017007402  0.038312157  0.017111411
## Lag 100  0.01161494 -0.003072026  0.008790121  0.009485982 -0.009097463
## Lag 500 -0.01678479  0.011295545 -0.019092348 -0.011615800 -0.026279325
##               Fst11       Fst12        Fst13        Fst14
## Lag 0    1.00000000  1.00000000  1.000000000  1.000000000
## Lag 10   0.24928017  0.23567882  0.062883747  0.072533073
## Lag 50  -0.00350218  0.02681047  0.004413889  0.020346025
## Lag 100  0.02125469 -0.01113564 -0.003756937 -0.007870545
## Lag 500 -0.01824956  0.03374842 -0.019715862  0.027519696
levelplot(t(autocorr.diag(chain)))

plot(chain)

3L hum

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/4.hum.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed         1       0.8539 
## Fst2  passed         1       0.2826 
## Fst3  passed       501       0.2712 
## Fst4  passed         1       0.8813 
## Fst5  passed         1       0.1483 
## Fst6  passed         1       0.2968 
## Fst7  passed         1       0.4333 
## Fst8  passed         1       0.7840 
## Fst9  passed         1       0.4666 
## Fst10 passed         1       0.8290 
## Fst11 passed         1       0.6421 
## Fst12 passed         1       0.6950 
## Fst13 passed         1       0.5849 
## Fst14 passed       501       0.0824 
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00359 9.26e-07 
## Fst2  passed    0.03313 2.98e-06 
## Fst3  passed    0.01582 1.95e-06 
## Fst4  passed    0.01593 1.43e-06 
## Fst5  passed    0.07050 5.11e-06 
## Fst6  passed    0.45914 1.84e-05 
## Fst7  passed    0.43192 1.93e-05 
## Fst8  passed    0.00565 9.00e-07 
## Fst9  passed    0.00218 6.89e-07 
## Fst10 passed    0.00272 7.64e-07 
## Fst11 passed    0.27830 1.49e-05 
## Fst12 passed    0.09108 6.37e-06 
## Fst13 passed    0.00367 2.03e-06 
## Fst14 passed    0.00301 2.14e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 3327.687 3199.788 3465.883 3558.458 3418.884 3999.597 4083.657 3024.769 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 2854.547 2792.671 3068.050 3158.844 4384.425 4578.899
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                 Fst1         Fst2         Fst3         Fst4         Fst5
## Lag 0    1.000000000  1.000000000  1.000000000  1.000000000  1.000000000
## Lag 10   0.166670971  0.219353313  0.154530365  0.168240326  0.187612928
## Lag 50   0.029963413 -0.002809453 -0.004203943 -0.009584776  0.020442884
## Lag 100 -0.003724688 -0.002795210  0.009796831  0.019001688 -0.013133661
## Lag 500 -0.006402922  0.015530096 -0.009674081 -0.005687835 -0.005066436
##                 Fst6         Fst7        Fst8          Fst9        Fst10
## Lag 0    1.000000000  1.000000000  1.00000000  1.000000e+00  1.000000000
## Lag 10   0.110963273  0.100680117  0.24595386  2.527282e-01  0.212275967
## Lag 50  -0.006241574 -0.006084364  0.00529668  1.441980e-02  0.023611609
## Lag 100  0.008709438  0.010208802 -0.01553143 -4.126390e-03  0.003643766
## Lag 500  0.012949359  0.012170748  0.01301009 -7.310615e-05 -0.007978216
##                 Fst11        Fst12        Fst13        Fst14
## Lag 0    1.0000000000  1.000000000  1.000000000  1.000000000
## Lag 10   0.2004639582  0.225473950  0.064933822  0.043761680
## Lag 50   0.0063005603 -0.017658453  0.010328644 -0.002355145
## Lag 100  0.0006016564 -0.001880100  0.009025304  0.013010390
## Lag 500 -0.0062386807  0.008214764 -0.003762979  0.002940706
levelplot(t(autocorr.diag(chain)))

plot(chain)

X hum

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/5.hum.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed        1        0.4721 
## Fst2  passed        1        0.6473 
## Fst3  passed        1        0.8920 
## Fst4  passed        1        0.4007 
## Fst5  passed        1        0.5914 
## Fst6  failed       NA        0.0233 
## Fst7  passed        1        0.2899 
## Fst8  passed        1        0.3187 
## Fst9  passed        1        0.5342 
## Fst10 passed        1        0.4311 
## Fst11 passed        1        0.5918 
## Fst12 passed        1        0.1915 
## Fst13 passed        1        0.3622 
## Fst14 passed        1        0.3300 
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00772 2.17e-06 
## Fst2  passed    0.03891 6.62e-06 
## Fst3  passed    0.01852 3.88e-06 
## Fst4  passed    0.01613 2.61e-06 
## Fst5  passed    0.04713 7.15e-06 
## Fst6  <NA>           NA       NA 
## Fst7  passed    0.55161 3.43e-05 
## Fst8  passed    0.01331 2.29e-06 
## Fst9  passed    0.00568 2.07e-06 
## Fst10 passed    0.00840 2.24e-06 
## Fst11 passed    0.36144 2.77e-05 
## Fst12 passed    0.21543 1.70e-05 
## Fst13 passed    0.00208 2.88e-06 
## Fst14 passed    0.00873 3.66e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2710.102 2547.307 2574.828 3449.611 2842.847 3835.509 4178.982 3527.502 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 1677.179 2103.108 3543.324 4461.509 2425.455 4316.260
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                 Fst1         Fst2          Fst3         Fst4        Fst5
## Lag 0    1.000000000  1.000000000  1.0000000000  1.000000000  1.00000000
## Lag 10   0.242063462  0.270074865  0.2528946321  0.183293126  0.20129208
## Lag 50  -0.004118146  0.019220039  0.0030041110  0.003067413  0.02701408
## Lag 100  0.011373099  0.002883986 -0.0002327709 -0.015308562  0.02734832
## Lag 500 -0.002605754 -0.003780627  0.0038281603 -0.014544933 -0.01922636
##                 Fst6          Fst7         Fst8        Fst9       Fst10
## Lag 0    1.000000000  1.0000000000  1.000000000 1.000000000 1.000000000
## Lag 10   0.084160590  0.0892469411  0.172482276 0.315789671 0.213787054
## Lag 50   0.001101342 -0.0124873334 -0.028604644 0.069737895 0.030731975
## Lag 100 -0.020274937 -0.0008866355 -0.002903510 0.014594442 0.055926903
## Lag 500 -0.009153420  0.0001812845  0.001913346 0.008810818 0.005781042
##                Fst11        Fst12      Fst13       Fst14
## Lag 0    1.000000000  1.000000000 1.00000000 1.000000000
## Lag 10   0.126771821  0.080368355 0.25057287 0.073193152
## Lag 50   0.014887426  0.013747917 0.04334636 0.002407015
## Lag 100  0.005346662 -0.007461244 0.01318911 0.011800336
## Lag 500 -0.015038330  0.014212504 0.00596171 0.010077498
levelplot(t(autocorr.diag(chain)))

plot(chain)

2R temp

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/1.temp.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed       1         0.169  
## Fst2  passed       1         0.435  
## Fst3  passed       1         0.894  
## Fst4  passed       1         0.594  
## Fst5  passed       1         0.320  
## Fst6  passed       1         0.297  
## Fst7  passed       1         0.161  
## Fst8  passed       1         0.872  
## Fst9  passed       1         0.472  
## Fst10 passed       1         0.495  
## Fst11 passed       1         0.867  
## Fst12 passed       1         0.677  
## Fst13 passed       1         0.385  
## Fst14 passed       1         0.804  
##                                 
##       Halfwidth Mean   Halfwidth
##       test                      
## Fst1  passed    0.0190 1.96e-06 
## Fst2  passed    0.0790 5.26e-06 
## Fst3  passed    0.0440 3.42e-06 
## Fst4  passed    0.0356 2.66e-06 
## Fst5  passed    0.1472 7.82e-06 
## Fst6  passed    0.4568 1.59e-05 
## Fst7  passed    0.3972 1.57e-05 
## Fst8  passed    0.0143 1.52e-06 
## Fst9  passed    0.0124 1.44e-06 
## Fst10 passed    0.0115 1.50e-06 
## Fst11 passed    0.5073 1.43e-05 
## Fst12 passed    0.1255 7.07e-06 
## Fst13 passed    0.0132 2.24e-06 
## Fst14 passed    0.0185 2.48e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2392.269 2060.856 2204.002 2269.397 2581.103 2874.476 3433.181 2093.195 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 2047.521 1928.916 3081.762 2494.391 4087.099 4090.082
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                  Fst1          Fst2        Fst3        Fst4       Fst5
## Lag 0    1.0000000000  1.0000000000  1.00000000  1.00000000 1.00000000
## Lag 10   0.3042449196  0.3558172028  0.30004452  0.33669903 0.31888958
## Lag 50   0.0226607365  0.0377087136  0.03335936  0.01152828 0.02714029
## Lag 100 -0.0004451326 -0.0001930717 -0.01294484 -0.01727245 0.02387898
## Lag 500 -0.0188497134  0.0045594343  0.01218184 -0.01119516 0.02446348
##                Fst6         Fst7       Fst8       Fst9       Fst10        Fst11
## Lag 0    1.00000000  1.000000000 1.00000000 1.00000000  1.00000000  1.000000000
## Lag 10   0.26974026  0.185598955 0.36592219 0.36888190  0.39712308  0.237165103
## Lag 50  -0.01760238 -0.019246709 0.03042654 0.05206368  0.04475523 -0.008448042
## Lag 100 -0.03434568  0.009499576 0.02303678 0.02085191 -0.02360783  0.003932481
## Lag 500  0.01265510  0.008531358 0.01212723 0.03066081  0.01757296  0.016042067
##                Fst12       Fst13        Fst14
## Lag 0    1.000000000 1.000000000  1.000000000
## Lag 10   0.306000161 0.072828293  0.099901986
## Lag 50   0.021721084 0.001836542 -0.005450162
## Lag 100 -0.006710706 0.014873711  0.015755496
## Lag 500 -0.002891925 0.022964007 -0.015662965
levelplot(t(autocorr.diag(chain)))

plot(chain)

2L temp

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/2.temp.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed       1         0.432  
## Fst2  passed       1         0.501  
## Fst3  passed       1         0.497  
## Fst4  passed       1         0.273  
## Fst5  passed       1         0.449  
## Fst6  passed       1         0.172  
## Fst7  passed       1         0.440  
## Fst8  passed       1         0.998  
## Fst9  passed       1         0.674  
## Fst10 passed       1         0.223  
## Fst11 passed       1         0.084  
## Fst12 passed       1         0.635  
## Fst13 passed       1         0.116  
## Fst14 passed       1         0.747  
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.07363 6.74e-06 
## Fst2  passed    0.09407 7.83e-06 
## Fst3  passed    0.07098 6.22e-06 
## Fst4  passed    0.04079 4.07e-06 
## Fst5  passed    0.09700 6.79e-06 
## Fst6  passed    0.42795 1.76e-05 
## Fst7  passed    0.35664 1.75e-05 
## Fst8  passed    0.05040 4.91e-06 
## Fst9  passed    0.00853 1.58e-06 
## Fst10 passed    0.01645 2.11e-06 
## Fst11 passed    0.43065 1.69e-05 
## Fst12 passed    0.17148 1.02e-05 
## Fst13 passed    0.01080 2.88e-06 
## Fst14 passed    0.02174 3.46e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2053.486 2050.113 2268.026 1960.895 2655.629 3453.408 3556.143 1985.336 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 1666.255 2211.352 3049.465 2858.760 3608.087 3472.619
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                Fst1         Fst2        Fst3        Fst4        Fst5
## Lag 0    1.00000000  1.000000000  1.00000000 1.000000000 1.000000000
## Lag 10   0.34392719  0.324671788  0.33499768 0.361904807 0.277468874
## Lag 50   0.02036704  0.025131456  0.03185293 0.019660516 0.017081507
## Lag 100  0.02123328 -0.017644799 -0.01191047 0.023453873 0.002768169
## Lag 500 -0.02781497 -0.005399608 -0.05017545 0.006535658 0.022967335
##                 Fst6         Fst7         Fst8        Fst9       Fst10
## Lag 0    1.000000000  1.000000000  1.000000000  1.00000000  1.00000000
## Lag 10   0.182761457  0.168556586  0.379933807  0.37244660  0.36487053
## Lag 50  -0.003007605  0.029905644  0.034634111  0.02610361  0.00258225
## Lag 100 -0.010694124 -0.007559885 -0.029791774  0.01836752 -0.02306234
## Lag 500  0.003873643  0.013759884  0.007496159 -0.01970836  0.00929360
##              Fst11         Fst12       Fst13       Fst14
## Lag 0   1.00000000  1.0000000000 1.000000000 1.000000000
## Lag 10  0.24213026  0.2722802388 0.136834188 0.107347629
## Lag 50  0.01823515 -0.0003246063 0.010121010 0.008700780
## Lag 100 0.01434836 -0.0057425992 0.010499557 0.004908555
## Lag 500 0.01099866 -0.0162238026 0.007167753 0.001207633
levelplot(t(autocorr.diag(chain)))

plot(chain)

3R temp

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/3.temp.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed       1         0.959  
## Fst2  passed       1         0.916  
## Fst3  passed       1         0.509  
## Fst4  passed       1         0.674  
## Fst5  passed       1         0.695  
## Fst6  passed       1         0.946  
## Fst7  passed       1         0.978  
## Fst8  passed       1         0.516  
## Fst9  passed       1         0.491  
## Fst10 passed       1         0.317  
## Fst11 passed       1         0.868  
## Fst12 passed       1         0.152  
## Fst13 passed       1         0.488  
## Fst14 passed       1         0.260  
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00227 8.88e-07 
## Fst2  passed    0.02961 2.92e-06 
## Fst3  passed    0.01303 1.67e-06 
## Fst4  passed    0.01883 1.78e-06 
## Fst5  passed    0.05916 4.45e-06 
## Fst6  passed    0.49184 1.76e-05 
## Fst7  passed    0.43261 1.77e-05 
## Fst8  passed    0.00650 8.22e-07 
## Fst9  passed    0.00344 6.74e-07 
## Fst10 passed    0.00429 7.22e-07 
## Fst11 passed    0.31566 1.50e-05 
## Fst12 passed    0.09013 5.31e-06 
## Fst13 passed    0.00665 2.09e-06 
## Fst14 passed    0.00770 1.91e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2415.364 2211.350 2598.957 2379.492 2576.316 3298.200 3493.761 2597.133 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 2465.698 2560.458 2523.920 3111.177 3786.290 4498.068
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                Fst1         Fst2         Fst3        Fst4         Fst5
## Lag 0    1.00000000  1.000000000 1.000000e+00 1.000000000  1.000000000
## Lag 10   0.23547002  0.300688212 2.666899e-01 0.319618353  0.284876407
## Lag 50   0.02032158  0.019436690 3.118856e-02 0.016181911  0.007829523
## Lag 100 -0.01016892  0.005113932 8.999153e-05 0.003797978 -0.002901539
## Lag 500 -0.00294128 -0.001649672 5.641814e-03 0.027311238  0.008020046
##                  Fst6         Fst7         Fst8         Fst9        Fst10
## Lag 0    1.0000000000  1.000000000  1.000000000  1.000000000  1.000000000
## Lag 10   0.2048889666  0.177140944  0.265238017  0.266942105  0.259940898
## Lag 50  -0.0090468929 -0.024843331  0.006343313  0.022359732  0.024573615
## Lag 100  0.0403602447  0.002693342 -0.014586453  0.009325879  0.012827534
## Lag 500  0.0009769934  0.003137464 -0.013845268 -0.008611015 -0.003415362
##               Fst11       Fst12        Fst13        Fst14
## Lag 0   1.000000000  1.00000000  1.000000000  1.000000000
## Lag 10  0.290467898  0.23267746  0.058807820  0.052646197
## Lag 50  0.029945399 -0.01204357  0.024608536  0.003921911
## Lag 100 0.007460066 -0.01140690 -0.007267134 -0.013534382
## Lag 500 0.005547759 -0.01424428 -0.010924738  0.001419814
levelplot(t(autocorr.diag(chain)))

plot(chain)

3L temp

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/4.temp.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed          1      0.931  
## Fst2  passed          1      0.349  
## Fst3  passed          1      0.428  
## Fst4  passed          1      0.228  
## Fst5  passed          1      0.419  
## Fst6  passed          1      0.529  
## Fst7  passed          1      0.642  
## Fst8  passed          1      0.451  
## Fst9  passed          1      0.598  
## Fst10 passed          1      0.226  
## Fst11 passed          1      0.739  
## Fst12 passed       1001      0.325  
## Fst13 passed          1      0.544  
## Fst14 passed          1      0.171  
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00296 9.09e-07 
## Fst2  passed    0.02979 2.92e-06 
## Fst3  passed    0.01379 1.90e-06 
## Fst4  passed    0.01390 1.52e-06 
## Fst5  passed    0.06218 4.78e-06 
## Fst6  passed    0.45503 1.96e-05 
## Fst7  passed    0.42998 1.97e-05 
## Fst8  passed    0.00536 9.19e-07 
## Fst9  passed    0.00211 6.36e-07 
## Fst10 passed    0.00282 6.75e-07 
## Fst11 passed    0.28637 1.44e-05 
## Fst12 passed    0.09370 7.09e-06 
## Fst13 passed    0.00422 2.15e-06 
## Fst14 passed    0.00377 2.18e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 3464.379 3011.465 2947.628 2940.803 3290.506 3517.191 3857.843 2551.180 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 2745.558 3193.193 3252.568 3289.817 4418.774 4110.839
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                 Fst1         Fst2         Fst3         Fst4        Fst5
## Lag 0    1.000000000  1.000000000  1.000000000  1.000000000  1.00000000
## Lag 10   0.155833414  0.206810988  0.194777505  0.238179689  0.22078041
## Lag 50   0.016852494  0.006743189  0.024069595  0.022481998  0.03199996
## Lag 100  0.034147616 -0.008170037 -0.014832078  0.009286181  0.01404790
## Lag 500 -0.006903699  0.011510589 -0.005226999 -0.009888611 -0.02507923
##                 Fst6        Fst7       Fst8        Fst9        Fst10
## Lag 0    1.000000000  1.00000000 1.00000000  1.00000000  1.000000000
## Lag 10   0.152771613  0.12874630 0.22094809  0.21536859  0.220335019
## Lag 50  -0.021530300  0.00542742 0.04804768  0.02625499  0.008744369
## Lag 100  0.007371122  0.04167123 0.01807723 -0.02233681 -0.020644073
## Lag 500 -0.007771695 -0.01183504 0.01694634 -0.01490340  0.017005151
##                Fst11        Fst12         Fst13        Fst14
## Lag 0    1.000000000  1.000000000  1.0000000000  1.000000000
## Lag 10   0.211552877  0.206107671  0.0615100208  0.097395610
## Lag 50   0.007951997  0.008422355 -0.0008274452 -0.004911889
## Lag 100 -0.001314261 -0.012371428 -0.0118150949 -0.008606635
## Lag 500 -0.021475198  0.001311543 -0.0124779531  0.003365017
levelplot(t(autocorr.diag(chain)))

plot(chain)

X temp

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/5.temp.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed          1      0.2626 
## Fst2  passed          1      0.2029 
## Fst3  passed       1501      0.1513 
## Fst4  passed          1      0.0667 
## Fst5  passed          1      0.2337 
## Fst6  passed          1      0.0786 
## Fst7  passed          1      0.6822 
## Fst8  passed          1      0.2935 
## Fst9  passed          1      0.7620 
## Fst10 passed          1      0.9486 
## Fst11 passed          1      0.4700 
## Fst12 passed          1      0.1575 
## Fst13 passed       1001      0.0502 
## Fst14 passed          1      0.4732 
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00538 2.04e-06 
## Fst2  passed    0.02779 5.92e-06 
## Fst3  passed    0.01146 4.29e-06 
## Fst4  passed    0.00999 2.10e-06 
## Fst5  passed    0.03249 5.31e-06 
## Fst6  passed    0.58778 3.17e-05 
## Fst7  passed    0.54927 3.36e-05 
## Fst8  passed    0.01085 1.98e-06 
## Fst9  passed    0.00450 1.15e-06 
## Fst10 passed    0.00760 1.62e-06 
## Fst11 passed    0.45822 2.76e-05 
## Fst12 passed    0.23527 1.73e-05 
## Fst13 passed    0.00962 4.81e-06 
## Fst14 passed    0.01623 4.29e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2691.559 2097.295 2005.204 2771.339 3100.671 4198.742 4317.007 3047.346 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 3197.649 2945.189 3613.704 4389.094 3905.212 4374.512
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                 Fst1         Fst2        Fst3        Fst4        Fst5
## Lag 0    1.000000000  1.000000000  1.00000000 1.000000000  1.00000000
## Lag 10   0.247083844  0.284414490  0.29144738 0.222265695  0.16371504
## Lag 50   0.003222022  0.032488281  0.04981576 0.034732693  0.01031547
## Lag 100  0.019122973 -0.002806995  0.01566395 0.006654658 -0.02529919
## Lag 500 -0.004043076 -0.018519751 -0.02412186 0.009981333  0.01007285
##                  Fst6         Fst7       Fst8        Fst9       Fst10
## Lag 0    1.0000000000  1.000000000 1.00000000  1.00000000 1.000000000
## Lag 10   0.0869066826  0.073107064 0.18559709  0.19580414 0.158163428
## Lag 50   0.0078338922 -0.006113051 0.02074265  0.02771014 0.014531767
## Lag 100  0.0001182754 -0.011184935 0.01586157 -0.01977302 0.004750552
## Lag 500 -0.0017840469  0.010656763 0.01928425 -0.01313373 0.012312609
##               Fst11        Fst12         Fst13        Fst14
## Lag 0    1.00000000  1.000000000  1.0000000000  1.000000000
## Lag 10   0.13644676  0.064866263  0.0920485316  0.041535224
## Lag 50   0.01810662 -0.003168005 -0.0004252882  0.018672300
## Lag 100  0.02157343  0.002090816  0.0121205276 -0.009688342
## Lag 500 -0.01283456 -0.015920269 -0.0089406902  0.005392791
levelplot(t(autocorr.diag(chain)))

plot(chain)

2R precip

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/1.precip.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed       1         0.0950 
## Fst2  passed       1         0.6992 
## Fst3  passed       1         0.2396 
## Fst4  passed       1         0.1543 
## Fst5  passed       1         0.8536 
## Fst6  passed       1         0.7476 
## Fst7  passed       1         0.1177 
## Fst8  passed       1         0.6723 
## Fst9  passed       1         0.5305 
## Fst10 passed       1         0.4773 
## Fst11 passed       1         0.1375 
## Fst12 passed       1         0.7335 
## Fst13 passed       1         0.0563 
## Fst14 passed       1         0.2195 
##                                 
##       Halfwidth Mean   Halfwidth
##       test                      
## Fst1  passed    0.0204 2.05e-06 
## Fst2  passed    0.0836 5.17e-06 
## Fst3  passed    0.0474 3.62e-06 
## Fst4  passed    0.0406 2.76e-06 
## Fst5  passed    0.1550 8.19e-06 
## Fst6  passed    0.4605 1.64e-05 
## Fst7  passed    0.3994 1.58e-05 
## Fst8  passed    0.0152 1.78e-06 
## Fst9  passed    0.0140 1.50e-06 
## Fst10 passed    0.0123 1.58e-06 
## Fst11 passed    0.5002 1.45e-05 
## Fst12 passed    0.1194 6.89e-06 
## Fst13 passed    0.0129 2.14e-06 
## Fst14 passed    0.0176 2.28e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2321.619 2269.473 2212.116 2548.863 2464.739 2909.981 3055.390 1745.441 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 2177.850 1885.115 3015.433 2550.350 4217.141 4788.209
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                 Fst1          Fst2        Fst3         Fst4         Fst5
## Lag 0    1.000000000  1.0000000000 1.000000000  1.000000000  1.000000000
## Lag 10   0.279035056  0.3491191559 0.316339429  0.324523910  0.298944818
## Lag 50   0.042700420  0.0199747514 0.046890794 -0.010406384  0.017838206
## Lag 100 -0.024328048  0.0008413047 0.007500330 -0.006107843  0.011860149
## Lag 500 -0.004804272 -0.0184593771 0.006677306  0.012839048 -0.004369266
##                Fst6        Fst7         Fst8        Fst9       Fst10
## Lag 0   1.000000000  1.00000000  1.000000000  1.00000000  1.00000000
## Lag 10  0.242538890  0.21558703  0.412727094  0.36520989  0.41293749
## Lag 50  0.003750541 -0.01254928  0.062369581  0.01625179  0.04022761
## Lag 100 0.004239439  0.01125442  0.019605666 -0.01625979 -0.01371651
## Lag 500 0.004150855  0.01632200 -0.002384758  0.01053419  0.02648554
##                 Fst11        Fst12        Fst13       Fst14
## Lag 0    1.0000000000  1.000000000  1.000000000 1.000000000
## Lag 10   0.2474054790  0.324262963  0.084736492 0.034856131
## Lag 50   0.0123022783  0.021086743  0.020605174 0.005192176
## Lag 100 -0.0007289595 -0.009306172  0.012728939 0.024543546
## Lag 500 -0.0114219891  0.023924651 -0.005707101 0.010621592
levelplot(t(autocorr.diag(chain)))

plot(chain)

2L precip

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/2.precip.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed       1         0.1466 
## Fst2  passed       1         0.5393 
## Fst3  passed       1         0.1785 
## Fst4  passed       1         0.7888 
## Fst5  passed       1         0.0654 
## Fst6  passed       1         0.6292 
## Fst7  passed       1         0.7924 
## Fst8  passed       1         0.2902 
## Fst9  passed       1         0.5813 
## Fst10 passed       1         0.2968 
## Fst11 passed       1         0.6113 
## Fst12 passed       1         0.9727 
## Fst13 passed       1         0.0682 
## Fst14 passed       1         0.8447 
##                                 
##       Halfwidth Mean   Halfwidth
##       test                      
## Fst1  passed    0.0828 6.97e-06 
## Fst2  passed    0.1118 8.00e-06 
## Fst3  passed    0.0855 6.87e-06 
## Fst4  passed    0.0504 4.43e-06 
## Fst5  passed    0.1086 7.04e-06 
## Fst6  passed    0.4386 1.81e-05 
## Fst7  passed    0.3622 1.72e-05 
## Fst8  passed    0.0633 5.41e-06 
## Fst9  passed    0.0111 1.78e-06 
## Fst10 passed    0.0216 2.53e-06 
## Fst11 passed    0.4164 1.71e-05 
## Fst12 passed    0.1576 9.94e-06 
## Fst13 passed    0.0112 2.64e-06 
## Fst14 passed    0.0243 3.38e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2325.429 2541.174 2410.012 2254.678 2868.554 3413.676 3627.546 2184.273 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 1948.314 2093.973 3026.689 2865.720 3780.262 4015.084
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                Fst1         Fst2       Fst3         Fst4          Fst5
## Lag 0   1.000000000  1.000000000 1.00000000  1.000000000  1.0000000000
## Lag 10  0.325335133  0.303912427 0.31622387  0.316553878  0.2429898481
## Lag 50  0.045236999  0.013360625 0.01468776  0.032365190 -0.0022162063
## Lag 100 0.002207994 -0.002298749 0.01197014  0.008727453  0.0054354023
## Lag 500 0.037239985  0.010289229 0.01334075 -0.012730006  0.0009585748
##                  Fst6        Fst7        Fst8       Fst9      Fst10       Fst11
## Lag 0    1.0000000000 1.000000000 1.000000000 1.00000000 1.00000000  1.00000000
## Lag 10   0.1873413072 0.158883076 0.372209870 0.37740652 0.37686383  0.24565568
## Lag 50  -0.0004343552 0.028203163 0.003878589 0.02675199 0.03762267 -0.01334104
## Lag 100 -0.0114548783 0.017476114 0.011309260 0.03459641 0.01180169  0.01325005
## Lag 500 -0.0033911565 0.002692615 0.012881890 0.01213164 0.01469708  0.02912510
##                 Fst12        Fst13        Fst14
## Lag 0    1.0000000000  1.000000000  1.000000000
## Lag 10   0.2711540573  0.111114235  0.109054381
## Lag 50   0.0240830025  0.018676261  0.028990277
## Lag 100  0.0007908884  0.001585796 -0.008877302
## Lag 500 -0.0098078954 -0.011074998  0.018973711
levelplot(t(autocorr.diag(chain)))

plot(chain)

3R precip

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/3.precip.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed         1       0.0749 
## Fst2  passed         1       0.4759 
## Fst3  passed         1       0.9048 
## Fst4  passed         1       0.5716 
## Fst5  passed         1       0.4967 
## Fst6  passed       501       0.0695 
## Fst7  passed         1       0.9066 
## Fst8  passed         1       0.6905 
## Fst9  passed         1       0.4254 
## Fst10 passed         1       0.5929 
## Fst11 passed         1       0.4167 
## Fst12 passed         1       0.4192 
## Fst13 passed         1       0.9425 
## Fst14 passed         1       0.9835 
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00362 9.29e-07 
## Fst2  passed    0.03690 3.12e-06 
## Fst3  passed    0.01746 1.81e-06 
## Fst4  passed    0.02273 1.77e-06 
## Fst5  passed    0.06793 4.94e-06 
## Fst6  passed    0.49942 1.87e-05 
## Fst7  passed    0.43812 1.86e-05 
## Fst8  passed    0.00683 8.98e-07 
## Fst9  passed    0.00427 8.17e-07 
## Fst10 passed    0.00439 7.70e-07 
## Fst11 passed    0.30194 1.33e-05 
## Fst12 passed    0.08677 5.26e-06 
## Fst13 passed    0.00582 1.83e-06 
## Fst14 passed    0.00608 1.85e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2757.543 2486.818 2750.696 2949.755 2413.247 3180.299 3369.001 2639.708 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 2316.895 2752.760 2918.441 3198.534 4268.424 4385.900
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                  Fst1        Fst2         Fst3        Fst4         Fst5
## Lag 0    1.0000000000 1.000000000  1.000000000  1.00000000  1.000000000
## Lag 10   0.2074898958 0.294920773  0.251235605  0.25771369  0.271790253
## Lag 50   0.0004278046 0.027834296  0.002629771  0.01782778  0.028093022
## Lag 100 -0.0081154933 0.020992786 -0.001151065 -0.02079587  0.003812995
## Lag 500 -0.0341687512 0.002571793  0.005167771 -0.02314754 -0.013235729
##                 Fst6         Fst7         Fst8         Fst9         Fst10
## Lag 0    1.000000000  1.000000000  1.000000000  1.000000000  1.0000000000
## Lag 10   0.192336455  0.152377049  0.280683075  0.274224458  0.2416794838
## Lag 50   0.025310327  0.009760333  0.009364102  0.026609857 -0.0073825259
## Lag 100 -0.001719299  0.023882345  0.012818362 -0.009018276 -0.0029911294
## Lag 500  0.001545842 -0.009988508 -0.002701476  0.002842438 -0.0005693784
##                Fst11        Fst12       Fst13        Fst14
## Lag 0    1.000000000  1.000000000  1.00000000  1.000000000
## Lag 10   0.266319381  0.219539856  0.07873323  0.065228713
## Lag 50   0.005403578 -0.013228305 -0.01359625 -0.022689042
## Lag 100 -0.025248772  0.003779874 -0.01682147 -0.007697065
## Lag 500  0.005995927  0.005560467 -0.01980415 -0.025335665
levelplot(t(autocorr.diag(chain)))

plot(chain)

3L precip

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/4.precip.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed          1      0.0593 
## Fst2  passed          1      0.3878 
## Fst3  passed       1501      0.1411 
## Fst4  passed          1      0.7262 
## Fst5  passed          1      0.0758 
## Fst6  passed          1      0.1468 
## Fst7  passed          1      0.4003 
## Fst8  passed          1      0.1202 
## Fst9  passed          1      0.3467 
## Fst10 passed          1      0.1516 
## Fst11 passed          1      0.7623 
## Fst12 passed          1      0.0832 
## Fst13 passed          1      0.1131 
## Fst14 passed          1      0.2436 
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00377 1.00e-06 
## Fst2  passed    0.03466 3.14e-06 
## Fst3  passed    0.01666 2.54e-06 
## Fst4  passed    0.01588 1.51e-06 
## Fst5  passed    0.06978 5.06e-06 
## Fst6  passed    0.45994 1.86e-05 
## Fst7  passed    0.43354 1.92e-05 
## Fst8  passed    0.00561 8.81e-07 
## Fst9  passed    0.00249 7.23e-07 
## Fst10 passed    0.00282 7.59e-07 
## Fst11 passed    0.27781 1.44e-05 
## Fst12 passed    0.09121 6.22e-06 
## Fst13 passed    0.00380 1.95e-06 
## Fst14 passed    0.00282 2.06e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 3303.063 3120.311 3099.876 3286.533 3475.422 3786.719 4004.836 3080.533 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 2737.336 3011.735 3264.489 3355.545 4614.069 4380.008
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                 Fst1          Fst2         Fst3         Fst4         Fst5
## Lag 0    1.000000000  1.0000000000  1.000000000  1.000000000  1.000000000
## Lag 10   0.154442504  0.1911050674  0.190545771  0.148707939  0.179688678
## Lag 50   0.027457550 -0.0014849752  0.001936073 -0.015810083  0.012772222
## Lag 100  0.001185419  0.0213236072  0.008901381  0.026907068 -0.013881445
## Lag 500 -0.013719580 -0.0007043743 -0.015596771  0.002254101  0.006045462
##                 Fst6        Fst7        Fst8         Fst9        Fst10
## Lag 0    1.000000000  1.00000000  1.00000000  1.000000000  1.000000000
## Lag 10   0.137884968  0.13343055  0.20720932  0.212499412  0.207790856
## Lag 50   0.014641027 -0.01086681 -0.01189910 -0.004713441  0.009122473
## Lag 100  0.002662847 -0.01623026  0.01399501 -0.008088975  0.003299975
## Lag 500 -0.004111614 -0.03393287 -0.02690997  0.010769362 -0.002593542
##               Fst11        Fst12        Fst13        Fst14
## Lag 0   1.000000000  1.000000000  1.000000000  1.000000000
## Lag 10  0.177060684  0.196617709  0.039942530  0.065897984
## Lag 50  0.006877828 -0.008366394  0.005346202  0.021497718
## Lag 100 0.008574525  0.005165060  0.004081798 -0.003552256
## Lag 500 0.015043778 -0.015157178 -0.005918661  0.006844219
levelplot(t(autocorr.diag(chain)))

plot(chain)

X precip

#read in trace file
chain <- read.table("~/Desktop/bayescenv.results/5.precip.sel" , header = TRUE)
chain <- mcmc(chain , thin = 10) #Adapt thin to its actual value (10 is the default)
chain<-chain[,3:ncol(chain)]
heidel.diag(chain)             #To test for convergence
##                                     
##       Stationarity start     p-value
##       test         iteration        
## Fst1  passed          1      0.185  
## Fst2  passed          1      0.544  
## Fst3  passed          1      0.817  
## Fst4  passed          1      0.444  
## Fst5  passed          1      0.938  
## Fst6  passed          1      0.343  
## Fst7  passed          1      0.927  
## Fst8  passed          1      0.645  
## Fst9  passed          1      0.461  
## Fst10 passed          1      0.429  
## Fst11 passed          1      0.618  
## Fst12 passed          1      0.874  
## Fst13 passed          1      0.465  
## Fst14 passed       1001      0.348  
##                                  
##       Halfwidth Mean    Halfwidth
##       test                       
## Fst1  passed    0.00980 2.44e-06 
## Fst2  passed    0.04032 6.37e-06 
## Fst3  passed    0.01866 3.96e-06 
## Fst4  passed    0.01717 3.00e-06 
## Fst5  passed    0.04741 6.01e-06 
## Fst6  passed    0.59466 3.18e-05 
## Fst7  passed    0.55286 3.31e-05 
## Fst8  passed    0.01239 2.19e-06 
## Fst9  passed    0.00715 1.59e-06 
## Fst10 passed    0.00886 1.88e-06 
## Fst11 passed    0.33983 2.69e-05 
## Fst12 passed    0.21633 1.77e-05 
## Fst13 passed    0.00120 2.77e-06 
## Fst14 passed    0.00628 3.80e-06
effectiveSize(chain)           #To compute effective sample size
##     Fst1     Fst2     Fst3     Fst4     Fst5     Fst6     Fst7     Fst8 
## 2725.776 2775.216 2461.926 2987.504 3680.753 4098.921 4426.542 3248.299 
##     Fst9    Fst10    Fst11    Fst12    Fst13    Fst14 
## 3241.979 3115.575 3647.149 4023.603 2069.145 3735.027
plot(effectiveSize(chain), xaxt='n', ylim=c(0,max(effectiveSize(chain))))+ abline(h=1000, col="red")+ axis(1, at=c(1:length(effectiveSize(chain))), labels=colnames(chain))

## numeric(0)
autocorr.diag(chain)           #To look for auto-correlation
##                Fst1         Fst2         Fst3        Fst4         Fst5
## Lag 0    1.00000000  1.000000000  1.000000000 1.000000000  1.000000000
## Lag 10   0.24415934  0.249295020  0.288593909 0.206370152  0.151778289
## Lag 50   0.03093667 -0.005745792  0.030530760 0.014825666 -0.022041685
## Lag 100 -0.02987944 -0.013353832 -0.001452828 0.003652313  0.009345431
## Lag 500 -0.03543258 -0.023356507 -0.006145148 0.019744592 -0.021071159
##                  Fst6         Fst7         Fst8         Fst9       Fst10
## Lag 0    1.0000000000  1.000000000  1.000000000  1.000000000 1.000000000
## Lag 10   0.0988333468  0.060635120  0.176429411  0.205965864 0.198283150
## Lag 50  -0.0030011630 -0.007935019 -0.019761690  0.023252202 0.026701067
## Lag 100 -0.0001023968  0.016931640 -0.017285863 -0.029595664 0.003537505
## Lag 500 -0.0030713893  0.003075813 -0.004052689  0.009918183 0.015500000
##               Fst11        Fst12       Fst13        Fst14
## Lag 0    1.00000000  1.000000000 1.000000000  1.000000000
## Lag 10   0.15625537  0.087244969 0.369219377  0.108982968
## Lag 50  -0.02331813 -0.029363383 0.043910244 -0.002319849
## Lag 100  0.01723236  0.012257628 0.032956149 -0.001070018
## Lag 500  0.03112715 -0.007413103 0.004300561  0.020137330
levelplot(t(autocorr.diag(chain)))

plot(chain)